package com.linked.basemanage.base.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.linked.basemanage.base.bean.param.BaseInfoPageParam;
import com.linked.basemanage.base.bean.po.BaseInfoPO;
import com.linked.basemanage.base.mapper.IBaseInfoMapper;
import com.linked.basemanage.base.service.IBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author :dbq
 * @date : 2022/11/23 8:49
 */
@Service
public class BaseServiceImpl implements IBaseService {

    private final IBaseInfoMapper baseInfoMapper;

    @Autowired
    public BaseServiceImpl(IBaseInfoMapper baseInfoMapper) {
        this.baseInfoMapper = baseInfoMapper;
    }

    @Override
    public IPage<BaseInfoPO> queryBaseInfoPage(BaseInfoPageParam param) throws Exception {
        return baseInfoMapper.queryBaseInfoPage(param);
    }

    @Override
    public boolean saveBaseInfo(BaseInfoPO param) throws Exception {
        return baseInfoMapper.insert(param) > 0;
    }

    @Override
    public BaseInfoPO findBaseInfo(String baseKey) throws Exception {
        return baseInfoMapper.findBaseInfo(baseKey);
    }
}
